Ext.define('MyApp.controller.Ctrl', {
    extend: 'Ext.app.Controller',
    stores: ['Store'],
    models: ['Model'],
    views: ['Viewport','View', 'EditView'],
    requires: ['MyApp.controller.EditCtrl'],
    init: function() {
        this.callParent();
        this.control({
            'view button[name=btn-add]': {
                click: this.AddClick
            }
        });
    },

    editUser: function(grid, record) {
        //var edit = Ext.create('MyApp.view.UserEditView').show();
        var win = Ext.widget("editview");
        win.show();
    },

    /**
     * 按钮添加事件
     * @param button
     * @constructor
     */
    AddClick:function(button){
        //加载供应商编辑控制器
        WX.Ext.Util.loadController(this.application, "MyApp.controller.EditCtrl");
        //取得供应商window
        var win = WX.Ext.Util.getWin('editview');
        //设置编辑框可编辑
        //ACBEE.Ext.Util.disableCompoment([win.down('button[name=btn-add]')], win.down('form'), false);
        //清除表单内容
        //win.down('form').getForm().reset();
        //设置供应商Id为零
        //win.oldSupplierId = 0;
        //保存当前表格的store
        win.parentStore = button.up('grid').getStore();
        win.setTitle('添加信息');
        win.show();
    }
});
